package org.example.ioc.pro3_ioc_componentscan;

import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

public class AppTest {
    public static void main(String[] args) {
        // 1. 创建容器对象
        ApplicationContext context = new AnnotationConfigApplicationContext(AppConfig.class);

//        AccountDao ad= (AccountDao) context.getBean("accountDao");
//        AccountService as= (AccountService) context.getBean("accountService");
//        Item it= (Item) context.getBean("item");
//
//        System.out.println(ad);
//        System.out.println(as);
//        System.out.println(it);
//
        String[] beanNames = context.getBeanDefinitionNames();
        for (String s : beanNames) {
            System.out.println(s);
        }
    }
}
